<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>报表</title>
</head>
<body>

部门:
<select id="depts">
</select>
薪资范围：<input type="number" value="0" id="min">--<input type="number" value="99999" id="max">

<button id="query">查询员工</button>

<hr>
<table border="1" id="empsInfo">
    <thead>
    <th>部门名称</th>
    <th>部门地址</th>
    <th>员工姓名</th>
    <th>工资</th>
    </thead>
</table>
<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
		$(function(){

		$("#query").click(function(){
		    $.ajax({
                url:"http://localhost:8080/reportDeptEmp",
                type:"post",
                data:{
                    "deptno":$("#depts").val(),
                    "min":$("#min").val(),
                    "max":$("#max").val()
                },
                success:function(res){
                    console.log(res)
                }
            })
        });

		$.ajax({
			url:"http://localhost:8080/deptall",
			type:"get",
			success:function(res){
				var resObj = JSON.parse(res);
				var depts = resObj.data;
				for(i in depts){
					var dept = depts[i];
				    $optionNode = $("<option></option>");
				    $optionNode.text(dept.dname);
					$optionNode.val(dept.deptno);
					$("#depts").append($optionNode);
				}
			}
		})
	})
</script>
</body>
</html>